export default {
	data() {
		return {
			title: "",
			url: "",
			opts: null,
			webviewStyles: {
				progress: {
					color: '#FF3333'
				}
			}
		}
	},
	async onLoad(options) {
		console.log("onLoad: ", options);
		this.title = options.title;
		this.opts = options.opts || null;
		const tmp = Date.now();
		this.url = `${options.url}?tmp=${tmp}&opts=${this.opts}`;
		uni.setNavigationBarTitle({
			title: this.title
		});
		// const self = this;
		// setTimeout(() => {
		// 	self.sendDataToJs();
		// }, 500);
	},
	async onShow() {},
	onHide() {},
	methods: {
		msgFromJs(e) {
			console.log("msgFromJs：", e.detail.data); //js传过来的参数
		},
		sendDataToJs() {
			console.log("sendDataToJs：1");
			const params = {
				message: 'Hello from uniapp'
			};
			// @ts-ignore
			uni.postMessage({
				data: params
			});
			console.log("sendDataToJs：2");
		}
	}
}